package cn.sciento.starter.social.wechat.enterprise.connection;

import cn.sciento.starter.social.core.common.api.SocialApi;
import cn.sciento.starter.social.core.common.connect.SocialApiAdapter;
import cn.sciento.starter.social.wechat.enterprise.api.WechatEnterpriseUser;
import org.springframework.social.connect.ConnectionValues;

public class WechatEnterpriseApiAdapter extends SocialApiAdapter {
  public WechatEnterpriseApiAdapter() {}
  
  public WechatEnterpriseApiAdapter(String providerUserId) {
    super(providerUserId);
  }
  
  public void setConnectionValues(SocialApi api, ConnectionValues values) {
    WechatEnterpriseUser user = (WechatEnterpriseUser)api.getUser(getProviderUserId());
    values.setDisplayName(user.getName());
    values.setImageUrl(user.getAvatar());
    values.setProviderUserId(user.getUserid());
  }
}
